﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Text;
using System.Reflection;
using log4net;
using Koonsoft.Tool.SendMessage;
using Koonsoft.Tool.CheckEveryday.Order;

namespace Koonsoft.Tool.CheckEveryday
{
    public class Program
    {
        private readonly static ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        static void Main(string[] args)
        {
            log.Info("开始统计订单，巡检异常");

            try
            {
                Koonsoft.Tool.CheckEveryday.Order.BLL.TodayOrder todayorder = new Koonsoft.Tool.CheckEveryday.Order.BLL.TodayOrder();
                Koonsoft.Tool.CheckEveryday.Order.BLL.ExceptionOrder exceptionorder = new Koonsoft.Tool.CheckEveryday.Order.BLL.ExceptionOrder();
                
                StringBuilder msg = new StringBuilder();
                msg.Append(todayorder.GetReport());
                msg.Append(exceptionorder.GetReport());

                SendShortMessage.SendToSingleTarget("订单统计及巡检",msg.ToString());
                log.Info("【发送短信】" + msg.ToString());                
            }
            catch (Exception ex)
            {
                log.Error("【悲剧发生】", ex);
            }

            System.Threading.Thread.Sleep(5000);
        }
    }
}
